package string;

public class StringBuildDemo {
    public static void main(String[] args) {
        String str="好好学习Java";
        StringBuilder builder=new StringBuilder(str);

        builder.append(",为了干活");   //追加内容 用append
        System.out.println(builder);

        builder.replace(9,16,"money");  //替换部分用 replace
        System.out.println(builder);

       //delete():删除部分内容（含头不含尾）
        builder.delete(0,5);
        System.out.println(builder);

        //insert():插入的内容
        builder.insert(1,"或者");
        System.out.println(builder);







        /*
        StringBuilder builder1=new StringBuilder();
        StringBuilder builder2=new StringBuilder("adc");
        String str="adc";
        StringBuilder builder3=new StringBuilder(str);
        String str2=builder3.toString();

         */
    }
}
